package com.zhentao.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import lombok.Data;

/**
 * 用户商品浏览历史表
 * @TableName user_browsing_history
 */
@TableName(value ="user_browsing_history")
@Data
public class UserBrowsingHistory {
    /**
     * 
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 浏览的商品ID
     */
    private Long productId;

    /**
     * 
     */
    private Date viewedAt;

    /**
     * 
     */
    private Date updatedAt;

    /**
     * 浏览次数
     */
    private Integer viewCount;

    /**
     * 最后浏览日期
     */
    private Date lastViewedDate;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        UserBrowsingHistory other = (UserBrowsingHistory) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getProductId() == null ? other.getProductId() == null : this.getProductId().equals(other.getProductId()))
            && (this.getViewedAt() == null ? other.getViewedAt() == null : this.getViewedAt().equals(other.getViewedAt()))
            && (this.getUpdatedAt() == null ? other.getUpdatedAt() == null : this.getUpdatedAt().equals(other.getUpdatedAt()))
            && (this.getViewCount() == null ? other.getViewCount() == null : this.getViewCount().equals(other.getViewCount()))
            && (this.getLastViewedDate() == null ? other.getLastViewedDate() == null : this.getLastViewedDate().equals(other.getLastViewedDate()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getProductId() == null) ? 0 : getProductId().hashCode());
        result = prime * result + ((getViewedAt() == null) ? 0 : getViewedAt().hashCode());
        result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
        result = prime * result + ((getViewCount() == null) ? 0 : getViewCount().hashCode());
        result = prime * result + ((getLastViewedDate() == null) ? 0 : getLastViewedDate().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", userId=").append(userId);
        sb.append(", productId=").append(productId);
        sb.append(", viewedAt=").append(viewedAt);
        sb.append(", updatedAt=").append(updatedAt);
        sb.append(", viewCount=").append(viewCount);
        sb.append(", lastViewedDate=").append(lastViewedDate);
        sb.append("]");
        return sb.toString();
    }
}